package edu.westga.movierec.XAMPPtests.reader;
import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import edu.westga.movierec.model.*;
/**
 * Test methods for {@link edu.westga.movierec.model.XamppDBConnector#userResponse}.
 * 
 * @author Jean Cook, CS 6242, Fall 2009
 *
 */
public class ResponseTests {
	private XamppDBConnector theDatabase;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		this.theDatabase = new XamppDBConnector();
	}
	@Test
	public void RatingShouldBe21WhenInputIsScreamOutputIsSawUserLiked(){
		this.theDatabase.userResponse("Scream","Saw",true);
		assertEquals(this.theDatabase.getMovieRating("Scream","Saw"),21);
	}
	@Test
	public void RatingShouldBe20WhenInputIsScreamOutputIsSawUserDidntLike(){
		this.theDatabase.userResponse("Scream","Saw",false);
		assertEquals(this.theDatabase.getMovieRating("Scream","Saw"),20);
	}
	@Test
	public void RatingShouldBe15WhenInputIsTitanicOutputIsScreamUserLikedFiveTimes(){
		for(int i=0;i<5;i++){
			this.theDatabase.userResponse("Titanic","Scream",true);
		}
		assertEquals(this.theDatabase.getMovieRating("Titanic","Scream"),15);
	}
	@Test
	public void RatingShouldBe10WhenInputIsTitanicmOutputIsScreamUserDidntLikeFiveTimes(){
		for(int i=0;i<5;i++){
			this.theDatabase.userResponse("Titanic","Scream",false);
		}
		assertEquals(this.theDatabase.getMovieRating("Titanic","Scream"),10);
	}
}
